package my.jwds.p804;

import java.util.HashSet;
import java.util.Set;

public class UniqueMorseRepresentations {
    public static void main(String[] args) {
        UniqueMorseRepresentations obj = new UniqueMorseRepresentations();

        System.out.println(obj.uniqueMorseRepresentations(new String[]{"adasdas","adasdas."}));
    }


    String[] map = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};

    public int uniqueMorseRepresentations(String[] words) {
        Set<String> set = new HashSet<>();
        for (String word : words) {
            StringBuilder sb = new StringBuilder();
            sb.hashCode();
            for (int i = 0; i < word.length(); i++) {
                sb.append(map[word.charAt(i) - 'a']);
            }

            System.out.println(sb.hashCode());
            set.add(sb.toString());
        }
        return set.size();
    }

}